<!-- page heading start-->
<div class="page-heading ng-scope">
	<ul class="breadcrumb">
		<li><a href="#"> 首页 </a></li>
		<li><a href="javascript:void(0);"> 广告管理 </a></li>
		<li class="active"> 广告列表</li>
	</ul>
</div>
<!-- page heading end-->
<div class="row">
	<div class="col-lg-12">
		<section class="panel">
			<header class="panel-heading">
				<span ng-if="adver.id != null"> 编辑广告 </span> 
				<span ng-if="adver.id == null"> 添加广告 </span>
			</header>
			<div class="panel-body">
				<form class="form-horizontal" name="myForm" id="acForm" enctype="multipart/form-data">
					<div class="form-group" ng-class="{'has-error':qaForm.adverName.$dirty && qaForm.adverName.$invalid}">
						<label for="inputTypeName" class="col-lg-2 col-sm-2 control-label" ng-required="true">广告名称</label>
						<div class="col-lg-10">
							<input type="text" ng-hide="true" ng-model="adver.id" name="adver.id"> 
							<input type="text" ng-model="adver.ad_name" name="adverName" ng-maxlength="32" ng-minlength="2" ng-required="true" class="form-control" placeholder="请输入广告名称">
							<label for="inputKey" ng-show="myForm.adverName.$dirty && myForm.adverName.$error.maxlength" class="alert alert-danger help-block"
								> 不能超过32个字符 </label> 
							<label for="inputKey" ng-show="myForm.adverName.$dirty && myForm.adverName.$error.minlength" class="alert alert-danger help-block"
								> 不能少于2个字符 </label>
						</div>
					</div>
                    
                    <div class="form-group">
                        <label for="inputTypeValue" class="col-sm-2 control-label">广告分类</label>
                        <div class="col-lg-10">
							<select ng-model="adver.adver_category_id" name="adver_category_id" class="form-control" ng-required="true"
								ng-options="category.id as category.ac_name for category in categoryList">
								<option value="">请选择</option>
							</select>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-2 col-sm-2 control-label">图片上传</label>
                        <div class="col-lg-10">
							<div class="htmleaf-container">
	                            <div class="kv-main">
									<input id="file" class="file" type="file">
									<!-- <input id="file-Portrait1" class="file" type="file"> -->
								</div>
							</div>
                        </div>
                    </div>
					
					<div class="form-group">
						<label class="col-lg-2 col-sm-2 control-label">是否上架</label>
                        <div class="col-lg-10">
							<label class="radio-inline" ng-init="context.adStatus = 1"> 
								<input type="radio" ng-model="adver.ad_status" name="adStatus" ng-checked="true" value="1" />是
							</label> 
							<label class="radio-inline"> 
								<input type="radio" ng-model="adver.ad_status" name="adStatus" value="0" />否
							</label>
						</div>
					</div>
					
					<div class="form-group" ng-class="{'has-error':qaForm.adSort.$dirty && qaForm.adSort.$invalid}">
						<label class="col-lg-2 col-sm-2 control-label">广告排序</label>
						<div class="col-lg-10">
							<input type="number" ng-model="adver.ad_sort" id="adSort" name="adSort" ng-maxlength="5" ng-minlength="1"
								ng-required="true" class="form-control" placeholder="请输入排序" /> 
							<div for="adSort"
								ng-show="myForm.adSort.$dirty && myForm.adSort.$error.maxlength" class="alert alert-danger help-block"
								>不能超过5个字符</div>
							<div ng-show="myForm.adSort.$dirty && myForm.adSort.$error.minlength" class="alert alert-danger help-block"
								>至少输入1个字符</div>
						</div>
					</div>

					<div class="form-group" ng-class="{'has-error':qaForm.adverPath.$dirty && qaForm.adverPath.$invalid}">
						<label class="col-lg-2 col-sm-2 control-label">广告链接</label>
						<div class="col-lg-10">
							<input type="text" ng-model="adver.ad_path" name="adverPath"
								class="form-control" ng-required="true" ng-maxlength="128" ng-minlength="2" placeholder="请输入广告链接"> 
							<label for="inputKey" ng-show="myForm.adverPath.$dirty && myForm.adverPath.$error.minlength" class="alert alert-danger help-block"
								> 不能少于2个字符 </label> 
							<label for="inputKey" ng-show="myForm.adverPath.$dirty && myForm.adverPath.$error.maxlength" class="alert alert-danger help-block"
								> 不能超过128个字符 </label>
						</div>
					</div>

					<div class="form-group">
						<label class="col-lg-2 col-sm-2 control-label">广告描述</label>
						<div class="col-lg-10">
							<textarea ck-editor class="form-control ckeditor" ng-model="adver.ad_description" name="adDescription" 
								ng-required="true" ng-maxlength="200"></textarea>
							<label for="inputKey" ng-show="myForm.adDescription.$dirty && myForm.adDescription.$error.maxlength" class="alert alert-danger help-block"
								class="error"> 最多能输入200字 </label>
						</div>
					</div>
					
					<div class="form-group">
						<div class="col-lg-offset-2 col-lg-10">
							<button type="submit" class="btn btn-danger" ng-disabled="myForm.$invalid" 
								ng-click="adver.id != null ? update():save()" >保存</button>
							<button type="button" class="btn btn-default" ng-click="back()">取消</button>
						</div>
					</div>
				</form>
			</div>
		</section>
	</div>
</div>